<template>
  <div>
    <h1>选项式API</h1>
    <h2>数字：{{ count }}</h2>
    <button @click="add" class="add">加+</button>
    <button @click="sub" class="sub">减-</button>
  </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      count: 0
    };
  },
  methods: {
    add() {
      this.count++;
    },
    sub() {
      this.count--;
    }
  },
  mounted() {
    console.log("mounted");
  }
};
</script>
<style>
.add {
  background-color: red;
}
.sub {
  background-color: green;
}
</style>
